import { SET_TAB, CLEAR_TAB, SET_SCROLLY, SET_CHANGE_SET } from "../actionType"
import { IAction } from "../../interface"

const initState: any = {
    tab: 0,
    screenY: 0,
    changeSet:true
}

export const tabReducer = (state = initState, action: IAction) => {
    const { type, payload } = action
    switch (type) {
        case SET_TAB:
            return { ...state, tab: payload }
            break;
        case CLEAR_TAB:
            return { ...state, tab: 0 }
            break;
        case SET_SCROLLY:
            return { ...state, tab: payload }
            break;
        case SET_CHANGE_SET:
            return { ...state, changeSet: payload }
            break;
        default:
            return state
    }
}